cmake_minimum_required(VERSION 3.10)

project(ProcessAndLogManager VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# 查找 Boost 库，并指定需要的组件
find_package(Boost REQUIRED COMPONENTS system thread filesystem)  # 加入filesystem
if(NOT Boost_FOUND)
    message(FATAL_ERROR "Boost库未找到。请确保已安装Boost并设置了正确的路径。")
endif()

set(SOURCES
    main.cpp
    ProcessMgr/process_manager.cpp
)

# 包含源文件目录
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# 创建可执行文件
add_executable(ProcessAndLogManager ${SOURCES})

# 设置 include 目录，包括 Boost 库的头文件目录
target_include_directories(ProcessAndLogManager PRIVATE
    ${Boost_INCLUDE_DIRS}            # 包含 Boost 头文件
    ${CMAKE_CURRENT_SOURCE_DIR}/ProcessMgr  # ProcessMgr 目录
)

# 链接库，包括 Boost 库和 pthread
target_link_libraries(ProcessAndLogManager PRIVATE
    ${Boost_LIBRARIES}
    pthread                            # POSIX线程库
)

# 编译选项: 如果是 GNU 或 Clang 编译器，添加编译警告选项
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
    target_compile_options(ProcessAndLogManager PRIVATE -Wall -Wextra -Werror)
endif()
